#ifndef DRAWJUNCTIONITEM_H
#define DRAWJUNCTIONITEM_H

#include <QObject>
#include <QGraphicsPolygonItem>
#include <QDebug>
#include <QPainter>
#include <QGraphicsSceneMouseEvent>


class DrawJunciontItem: public QObject, public QGraphicsPolygonItem
{
    Q_OBJECT

public:
    explicit DrawJunciontItem(QObject *parent = nullptr);

    virtual ~DrawJunciontItem()
    {
    }

    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR) Q_DECL_OVERRIDE;

    virtual QPolygonF drawJuncionAlogrithum(QPainter *painter);

protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
    void hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;

private:
    QVector<QPointF> m_qvecRoadPoints;
    int m_iStart;

    QRectF m_qRecFFirst;
    QRectF m_qRecFSecond;
    QRectF m_qRecFThird;

public slots:
    void setRect(QRectF);
};

#endif // DRAWJUNCTIONITEM_H
